package controller

import (
	"cms/core/response"
	"cms/model"
	"cms/utils/form_request"
	"github.com/gin-gonic/gin"
	"github.com/wdaglb/korm"
)

// GetAdminManagers 获取管理员列表
func GetAdminManagers(ctx *gin.Context)  {
	list := make([]model.Admin, 0)
	offset, limit := form_request.GetPageParams(ctx)
	db := korm.NewContext()
	if err := db.Model(&list).Offset(offset).Limit(limit).Select().Error; err != nil {
		response.Error(ctx, err)
		return
	}
	total, err := db.Model(model.Admin{}).Count()


	response.Success(ctx, gin.H{
		"list": list,
	})
}
